export function getOpenId() {
	wx.login({ // 这个方法可以拿到openid
		//获取code
		success: function(res) {
			var code = res.code; //返回code
			// console.log(res)
			// console.log(code);
			var appId = 'wx47e3d301cb86fab1';
			var secret = 'c0a71f643dadc4612f516c3961e48f42';
			wx.request({
				url: 'https://api.weixin.qq.com/sns/jscode2session?appid=' + appId + '&secret=' +
					secret + '&js_code=' + code + '&grant_type=authorization_code',
				data: {},
				header: {
					'content-type': 'json'
				},
				success: function(res) {
					// console.log(res)
					let openid = res.data.openid //返回openid
					wx.setStorageSync('OPENID', openid) //这里需要使用异步方法
					// console.log('openid为' + openid);
				}
			})
		}
	})
}
